<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h1>作用域规定如何查找变量，JavaScript 函数作用域在函数定义的时候就决定了</h1>
<script>
    var scope = 'global scope'

    function getScope () {
        var scope = 'local scope'

        function f () {
            console.log(scope) // local scope
            return scope
        }

        return f
    }

    console.log(getScope()()); // local scope
</script>
</body>
</html>
